﻿<style>
    .mypreview{
        background: rgba(0,0,0,.50);
    }

</style>
<div class="modal fade show mypreview" @onclick="Close" style="display: @_display">
    <div class="modal-dialog modal-dialog-centered modal-md" style="margin: auto">
        <img src="@_url" alt="" style="margin: 0 auto">
    </div>
</div>

@code {
    private string _url = "";
    private string _display = "none";

    private void Close()
    {
        _display = "none";
    }

    /// <summary>
    /// 显示预览
    /// </summary>
    /// <param name="url"></param>
    public void Show(string url)
    {
        _url = url;
        _display = "block";
        StateHasChanged();
    }
}